<?php

namespace App\Http\Controllers;

use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use App\Factories\RbacFactory as Rbac;
use App\Services\Msg as Msg;


abstract class Controller extends BaseController
{
    private $msg;

    use DispatchesJobs, ValidatesRequests;


    // 检查是否有权限
    public function can( $permission ){
    	return Rbac::can( $permission );
    }

    public function send($sta,$data="",$redirect=""){
        return Msg::send($sta,$data,$redirect);
    }

    public function showMsg($rsCode,$msg='',$url=''){

        return Msg::showMsg($rsCode,$msg,$url);
    }

    public function showMsgArr( Array $args ){

        $rsCode = isset($args['rsCode'])?$args['rsCode']:0;
        $msg = isset($args['msg'])?$args['msg']:"";
        $url = isset($args['url'])?$args['url']:"";


        return Msg::showMsg($rsCode,$msg,$url);
    }




}